Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form submission: Identify pressed submit button associated through form attribute #5190

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

raviks789
Copy link
Contributor

@raviks789 raviks789 commented Feb 20, 2024

Issue

When there are multiple submit buttons outside the form which are associated with it as shown below, the form fails to correctly identify the pressed submit button.

<html>
  <form id="test-form">
    <input type="text" name="name"/>
    <input value="Save" name="save" type="submit">
  </form>
  
  <div>
    <button type="submit" form="test-form" name="button-1">Button 1</button>
    <button type="submit" form="test-form" name="button-2">Button 2</button>
  </div>
</html>

Solution

In case the button is undefined upon submit event, get the pressed submit button using the submitter property found on the SubmitEvent interface.

public/js/icinga/events.js Outdated Show resolved Hide resolved
@nilmerg nilmerg force-pushed the fix/multiple-external-submit-buttons branch 2 times, most recently from 823dd53 to 8f277bf Compare November 4, 2024 15:00
@nilmerg nilmerg force-pushed the fix/multiple-external-submit-buttons branch from 8f277bf to ee57aee Compare November 4, 2024 15:02
@nilmerg nilmerg added this to the 2.12.2 milestone Nov 4, 2024
@nilmerg nilmerg added enhancement New feature or improvement area/javascript Affects the javascript framework labels Nov 4, 2024
@nilmerg nilmerg assigned nilmerg and unassigned raviks789 Nov 4, 2024
@nilmerg nilmerg merged commit eef276b into main Nov 4, 2024
22 checks passed
@nilmerg nilmerg deleted the fix/multiple-external-submit-buttons branch November 4, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/javascript Affects the javascript framework cla/signed enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants